package com.mUI;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.xike.kyt.R;
import com.xike.util.StringUtil;

public class MyUploadingDialog extends AlertDialog {
	Context context;
	private TextView btn_camera;
	private TextView btn_photo;
	private TextView tv_title;

	public MyUploadingDialog(Context context) {
		super(context);
		this.context = context;
	}

	int type;

	public MyUploadingDialog(Context context, int theme, int type) {
		super(context, theme);
		this.context = context;
		this.type = type;

	}

	public MyUploadingDialog(Context context, int type) {
		super(context);
		this.context = context;
		this.type = type;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		this.setContentView(R.layout.ui_uploadphoto);
		tv_title = (TextView) findViewById(R.id.upphoto_tv_title);
		btn_camera = (TextView) findViewById(R.id.upphoto_tv_camera);
		btn_photo = (TextView) findViewById(R.id.upphoto_tv_photo);
		findViewById(R.id.upphoto_btn_cancle).setOnClickListener(new android.view.View.OnClickListener() {

			@Override
			public void onClick(View v) {
				MyUploadingDialog.this.dismiss();
			}

		});
	}

	public void setTitle(String title) {
		if (StringUtil.isNotNull(title)) {
			tv_title.setText(title);
			tv_title.setVisibility(View.VISIBLE);
		}
	}

	/**
	 * 从手机相册选择
	 * 
	 * @param listener
	 */
	public void setOnBtnPhotoClickListener(android.view.View.OnClickListener listener) {
		btn_photo.setOnClickListener((android.view.View.OnClickListener) listener);
	}

	/**
	 * 拍照
	 * 
	 * @param listener
	 */
	public void setOnBtnTakePic(android.view.View.OnClickListener listener) {
		btn_camera.setOnClickListener((android.view.View.OnClickListener) listener);
	}
}
